<?php

namespace User\Factory\View\Helper;
use Zend\Authentication\AuthenticationService;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\View\HelperPluginManager;
use User\View\Helper\UserDisplayName;

class DisplayNameFactory implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $pluginManager)
    {
        /* @var $pluginManager HelperPluginManager */
        $serviceManager = $pluginManager->getServiceLocator();

        /* @var $authService AuthenticationService */
        $authService = $serviceManager->get('user_auth_service');

        $viewHelper = new UserDisplayName;
        $viewHelper->setAuthService($authService);

        return $viewHelper;
    }
} 